<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #content{
            width: 100px;
            height: 100px;
            margin: 10px auto;
            padding: 0;
            background: black;
        }
    </style>
</head>
<body>
    <div id="btn">
        <button>变宽</button>
        <button>变高</button>
        <button>变色</button>
        <button>隐藏</button>
        <button>重置</button>

    </div>
    <div id="content">

    </div>
</body>
<script>
    var changestyle=function(elem,attr,value){
        elem.style[attr]=value
    }
    window.onload=function(){
        var onBtn=document.getElementsByTagName('button')
        var ondiv=document.getElementById('content')
        var oatt=["width","height","background","display","display"]
        var oval=["200px","200px","pink","none","block"]
        for (let i = 0; i < onBtn.length; i++) {
            onBtn[i].index=i
            onBtn[i].onclick=function(){
                this.index==onBtn.length&&(ondiv.style.cssText=="")
                changestyle(ondiv,oatt[this.index],oval[this.index])
            }
            
        }
    }
</script>
</html>